import {useGetPostQuery} from '@/store/toolkit/RTKQuery.js'
import {Tag} from 'antd'
function index() {
     const {
    data: posts,
    isLoading,
  } = useGetPostQuery('page=1&pageSize=10')
  const {rows} = posts ||{}
  console.log('posts', rows);
    return ( <div>
        {rows?.map(item=>(
           <div key={item.id}> 
           <h3>{item.title}</h3>
           <div 
           style={{
                width: '600px',
                overflow: 'hidden',
                textOverflow: 'ellipsis',
                whiteSpace: 'nowrap',
           }}
           >{item.content.substring(0,60)}</div>
           <div>
            <span>查看次数：{item.viewCount}</span>
            <span> {item.tags.map(tg=><Tag>{tg.name}</Tag>)}</span>
           </div>
           </div> 
        ))}
    </div> );
}

export default index;